
package com.zsrt.day20170504.ch06;


public class Ticket {

	private Integer count;
	public Ticket(int c){
		count = c;
	}
	
	public synchronized String sell(String name){
		if(count>0){
			count --;
			return name+"购买成功，剩余"+count;
		}
		System.out.println("已售完");
		return null;
	}
}
